package thread;

import java.util.Scanner;

/*
 * @author zzr
 * @date: 2025/04/15  16:37
 * @description:
 */
public class Thread14 {
    private static volatile int flg = 0;
    public static void main(String[] args) {
        Thread t1 = new Thread(() -> {
            while (0 == flg) {
                // 什么都不做
            }
            System.out.println("t1 线程结束了");
        });
        Thread t2 = new Thread(() -> {
            Scanner scanner = new Scanner(System.in);
            System.out.println("请输入 flg 的值：");
            flg = scanner.nextInt();

        });

        t1.start();
        t2.start();
    }
}
